package NetEase;

import java.util.Scanner;

public class Main2 {
    public static void main(String[] args) {
        Scanner cin=new Scanner(System.in);
        String line=cin.nextLine();
        int n=line.length();
        if (n==1) {
            System.out.println(0);
            return;
        }
        int[] dp=new int[n];
        dp[1]=(line.charAt(1)==line.charAt(0)||Math.abs(line.charAt(0)-line.charAt(1))==1)?(line.charAt(1)-'a'+1+line.charAt(0)-'a'+1):0;
        for (int i = 2; i < n; i++) {
            if (line.charAt(i)==line.charAt(i-1)||Math.abs(line.charAt(i)-line.charAt(i-1))==1){
                dp[i]=Math.max(dp[i-1],dp[i-2]+line.charAt(i)-'a'+1+line.charAt(i-1)-'a'+1);
            }else {
                dp[i]=dp[i-1];
            }
        }
        System.out.println(dp[n-1]);
    }
}
